<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<div class="modal-dialog x-modal-dialog" style="width: 600px;margin-top: 150px;">

  <div class="modal-content">
  
    <div class="modal-header x-breadcrumb clearfix">

      <h2><i class="glyphicon glyphicon-fire" title=""></i>&nbsp;&nbsp;<span>编辑个人信息</span></h2>

      <button type="button" class="close" data-dismiss="modal">&times;</button>

    </div>
    
    <form class="form-horizontal" method="POST" action="${ctx.host}/principals/${principal.id}/special-tags" data-validate="true">

      <input type="hidden" name="_method" value="PATCH" >
      <input type="hidden" name="id" value="${principal.id}" >

      <div class="modal-body">·
      
        <div class="form-group">
          <label class="control-label col-xs-4">特色课擅长：</label>
          <div class="col-xs-6 pull-left">
            <c:choose>
              <c:when test="${principal.profile != null and principal.profile.specialTags != null}">
              <select name="specialTags" class="form-control" multiple="multiple">
	              <option value="BOXING" ${principal.profile.specialTags.contains('2') ? 'selected' : ''}>拳击</option>
	              <option value="HANG" ${principal.profile.specialTags.contains('3') ? 'selected' : ''}>悬挂训练</option>
	              <option value="STRETCH" ${principal.profile.specialTags.contains('4') ? 'selected' : ''}>拉伸</option>
	              <option value="FUNCTION" ${principal.profile.specialTags.contains('6') ? 'selected' : ''}>功能训练</option>
	              <option value="SHAPE" ${principal.profile.specialTags.contains('8') ? 'selected' : ''}>体态调整</option>
	              <option value="BABY" ${principal.profile.specialTags.contains('9') ? 'selected' : ''}>孕产恢复</option>
	              <option value="BODY" ${principal.profile.specialTags.contains('10') ? 'selected' : ''}>形体雕刻</option>
	              <option value="LING" ${principal.profile.specialTags.contains('5') ? 'selected' : ''}>壶铃专项</option>
	              <option value="VIPR" ${principal.profile.specialTags.contains('11') ? 'selected' : ''}>普拉提</option>
	            </select>
              </c:when>
              <c:otherwise>
              <select name="specialTags" class="form-control" multiple="multiple" id="courseAttr">
                <option value="BOXING">拳击</option>
                <option value="HANG">悬挂训练</option>
                <option value="STRETCH">拉伸</option>
                <option value="FUNCTION">功能训练</option>
                <option value="SHAPE">体态调整</option>
                <option value="BABY">孕产恢复</option>
                <option value="BODY">形体雕刻</option>
                <option value="LING">壶铃专项</option>
                <option value="VIPR">普拉提</option>
              </select>
              </c:otherwise>
            </c:choose>
            
          </div>
        </div>
        
      </div>
      <div class="modal-footer">
        <button type="submit" class="btn btn-success btn-shadow btn-shadow-success x-btn">确定</button>&nbsp;&nbsp;&nbsp;&nbsp;
        <button type="button" class="btn btn-default btn-shadow btn-shadow-default x-btn" data-dismiss="modal">取消</button>
      </div>

    </form>
  </div>
</div>

<script type="text/javascript">
  $(function(){
    
    $('select[name="specialTags"]').select2({  
      placeholder : '请选择特色',
      minimumResultsForSearch : 5,
      allowClear : true,
    })
    
  })
</script>